class YanghuiTriangle {
  private size: number;

  constructor(size: number) {
    this.size = size;
  }

  public getRow(rowIndex: number): number[] {
    if (rowIndex < 0 || rowIndex >= this.size) {
      return [];
    }
    const row = new Array(rowIndex + 1).fill(1);
      for (let i = 1; i < row.length - 1; i++) {
        //杨辉三角的核心算法
      row[i] = this.getRow(rowIndex - 1)[i - 1] + this.getRow(rowIndex - 1)[i];
    }
    return row;
  }
}
